//
//  GoodsListCell.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/23.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class GoodsListCell: BaseTableViewCell {
    
    
    @IBOutlet weak var leftImageView: UIImageView!
    
    
    @IBOutlet weak var nameLabel: UILabel!
    
    @IBOutlet weak var prieLabel: UILabel!
    
    @IBOutlet weak var saleLabel: UILabel!
    
    @IBOutlet weak var indetorView: UIActivityIndicatorView!
    
    var model : HomeItemModel?{
        
        didSet{
            
            if model == nil {
                return
            }
            
            indetorView.startAnimating()
            
            leftImageView.sd_setImage(with: URL(string: model!.goods_image_url), placeholderImage: UIImage.defaulImage(), options: .progressiveDownload) { (image, _, _, _) in
                self.indetorView.stopAnimating()
                
            }
            
            nameLabel.text = model?.goods_name
            
            prieLabel.text = "¥ \(model!.goods_price)"
            
            saleLabel.text = "销量: \(model!.goods_salenum)"
            
        }
        
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        contentView.backgroundColor = UIColor.white
        saleLabel.textColor = UIColor.darkGray
        
    }

    
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
